package mobileapps.samples;

import android.app.Activity;
import android.os.Bundle;

import android.text.InputFilter;
import android.view.ContextMenu;
import android.view.MenuItem;
import android.view.View;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.View.OnClickListener;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
import android.widget.Button;
import android.widget.EditText;
import android.widget.MultiAutoCompleteTextView;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;

public class P03TextInput extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
 
        		setContentView(R.layout.textinput);
        		
        		final EditText text1 = (EditText)findViewById(R.id.EditText01);
        		final EditText text2 = (EditText)findViewById(R.id.EditText02);
        		final EditText text_filtered =
                    (EditText) findViewById(R.id.input_filtered);
                text_filtered
                    .setFilters(new InputFilter[]
                    {
                        new InputFilter.AllCaps(),
                        new InputFilter.LengthFilter(5) });

        		final Button submit = (Button)findViewById(R.id.submit);
        		submit.setOnClickListener(new OnClickListener() {
        			public void onClick(View v) {
        				Toast.makeText(P03TextInput.this, "1 = "+text1.getText()+ " 2 = " + text2.getText()+
        						"3 = " + text_filtered.getText(), Toast.LENGTH_SHORT).show();
        			}    			
        		});  // edn of setOnClick code
            }
        }     
        
        
